cuda::isclose()#9577
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
SummaryThis PR adds ChangesImplementation (
|
| Layer / File(s) | Summary |
|---|---|
Documentation docs/libcudacxx/extended_api/numeric.rst, docs/libcudacxx/extended_api/numeric/isclose.rst |
Adds the new reference page, documents overloads and semantics, and registers the page in the numeric navigation and availability table. |
Internal helpers libcudacxx/include/cuda/__numeric/isclose.h |
Defines the comparison-type selector, default relative tolerance, overflow-safe integer difference, and the floating-point, complex, and integer implementations. |
Public overloads and header wiring libcudacxx/include/cuda/__numeric/isclose.h, libcudacxx/include/cuda/numeric |
Adds the public scalar and complex overloads, closes the namespace and include guard, and includes the new header from cuda/numeric. |
Test coverage libcudacxx/test/libcudacxx/cuda/numeric/isclose/isclose.pass.cpp |
Adds compile-time and runtime tests for floating-point, integral, and complex overloads, including invalid abs_tol cases and target-gated runtime coverage. |
Comment @coderabbitai help to get the list of available commands.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Jacob Faibussowitsch <jacob.fai@gmail.com>
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Jacob Faibussowitsch <jacob.fai@gmail.com>
😬 CI Workflow Results🟥 Finished in 2h 20m: Pass: 99%/120 | Total: 2d 17h | Max: 2h 20m | Hits: 75%/587960See results here. |
Description
Comparing two floating-point values is a widely used functionality. Every library that use floating-point values need to compare them at some point. CCCL used it too for internal testing.
Python has
math.isclose()https://peps.python.org/pep-0485/, andnumpy.isclose.Several C++ testing frameworks and libraries provide a similar utility,
GoogleTest,Catch2,Boost.Math,Eigen.This PR introduces 3 overloads for
isclose()following implementation decisions ofmath.isclose()we could also think to add interfaces based on C++20 designed initializer.
Supported types: integers, (extended) floating-point, complex (std. cuda, cuda::std).
Todo: documentation (currently a draft)
Requires:
__float128forisfinite()andisinf()#9576